# -*- coding: utf-8 -*-
"""
@文件    :   Students_import.py
@时间    :   2022/05/26 18:54:52
@作者    :   YTNetMan
@版本    :   1.0
@邮箱    :   ytnetman@163.com
@版权    :   (C)Copyright 2022-2025
@分类    :   办公自动化
@功能    :   导入外部文件
            read_csv可以导入 csv,tsv,txt文件
"""

from operator import index

import pandas as pd

#导入csv文件  用逗号分隔
students1 = pd.read_csv('./doc/Students_import.csv',index_col='ID')
# students1 = pd.read_csv('./doc/Students_import.csv')
# students1.to_json('./doc/Students_import.json',orient="records", lines=True,force_ascii=False)
print('==============students1=============')
print(students1)
#导入tsv文件   用制表符分隔
students2 = pd.read_csv('./doc/Students_import.tsv',sep='\t',index_col='ID')
print('==============students2=============')
print(students2)

#导入json文件   用制表符分隔
students3 = pd.read_json('./doc/Students_import.json',orient="records", lines=True)
students3 = pd.DataFrame(students3).set_index('ID')
print('==============students3=============')
print(students3)

#导入txt文件    用竖线分隔
students4 = pd.read_csv('./doc/Students_import.txt',sep='|',index_col='ID')
print('==============students4=============')
print(students4)
